import txios from '../index'
import type { IDataType } from '../types'
import { userApi } from './type'
import type { userID } from './type'

// export function getUserPlayList(ID: number) {
//   return txios.post<IDataType>({
//     url: userApi.playlist,

//     data: {
//       uid: ID
//     }
//   })

// }
//
export function getLikeSong(ID: number) {
  return txios.post<any>({
    url: userApi.likeList,
    data: {
      uid: ID
    }
  })
}

export function getNewSong() {
  return txios.post<any>({
    url: userApi.newsong
  })
}

export function getPlaylist(ID: number) {
  return txios.post<any>({
    url: userApi.getPlaylist,
    data: {
      uid: ID,
      limit: 8
    }
  })
}

export function getSongsById(IDs: number) {
  return txios.get<any>({
    url: userApi.getSongById,
    params: {
      id: IDs
    }
  })
}

export function getSongInfo(IDs: number[]) {
  let pramIDS = '?ids=' + IDs.map((item) => `${item}`).join(',')
  return txios.get<any>({
    url: userApi.getSongInfo + pramIDS
  })
}
export function getSongText(IDs: number[]) {
  return txios.post<any>({
    url: userApi.getSongText,
    data: {
      id: IDs
    }
  })
  // let pramIDS = '?ids=' + IDs.map((item) => `${item}`).join(',')
  // return txios.get<any>({
  //   url: userApi.getSongText + pramIDS
  // })
}

export function getSongsList(IDs: number) {
  let pramIDS = '?id=' + `${IDs}`
  return txios.post<any>({
    url: userApi.getSongsList + pramIDS
  })
}

export function getBanner() {
  return txios.get<any>({
    url: userApi.getBanner
  })
}
